﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Rio.Applications.Web.Services;
using Rio.Framework.Pages.Context;

namespace Rio.Framework.Pages.Manager
{
    public abstract class ManagerBase : IDisposable
    {
        private BusinessEntitiesDomainContext _DataContext;

        /// <summary>
        /// Return a reference to the DataContaxt
        /// </summary>
        protected BusinessEntitiesDomainContext GetDataContext
        {
            get
            {
                if (_DataContext == null)
                    _DataContext = GlobalWebContext.BusinessEntitiesDomainContext;
                return _DataContext;
            }
        }

        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        public virtual void Dispose()
        {
            _DataContext = null;
        }
    }
}
